package chtp02;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Scanner;

import javax.swing.plaf.synth.SynthSpinnerUI;
public class Main {
	static int[] num;
	
	public static int fibonacci(int n){  
	    if(n <= 2){  
	        return 1;  
	    }else{  
	        return fibonacci(n-1) + fibonacci(n-2);  
	    }  
	}    
	
	
	
	public static void main(String[] args) {
	
		Scanner input = new Scanner(System.in);
		int i,j;
		while(true) {
			String str=input.next();
			switch (str) {
			case "fib":
				int n=input.nextInt();
				for(i=1;i<n;i++) {
					System.out.print(fibonacci(i)+" ");
				}
				System.out.println(fibonacci(n));
				
				break;
			case "sort":
				input.nextLine();
				String[] str1=input.nextLine().split(" ");
				num = new int[str1.length];
				 for (i=0; i < str1.length; i++) {
				   num[i] = Integer.parseInt(String.valueOf(str1[i]));
				  }
				Arrays.sort(num);
				/*System.out.print("[");
				for (j= 0; j<num.length; j++) {
					if(j==0) {
						System.out.print(num[j]);
					}
					else {
						System.out.print(", "+num[j]);
					}
					  }
				System.out.print("]");*/
				System.out.println(Arrays.toString(num));
				break;
			case "search":
					int get=input.nextInt();
					
					int a=Arrays.binarySearch(num, get);
					if(a<0) {
						System.out.println("-1");
					}
					else {
						System.out.println(a);
					}
				
					break;
			case "getBirthDate":
					int number=input.nextInt();
				
					for(i=0;i<number;i++) {
						String str2=input.next();
						String year=str2.substring(6, 10);
						String month=str2.substring(10, 12);
						String date=str2.substring(12, 14);
						System.out.println(year+"-"+month+"-"+date);
					}
				
				   break;
			default:System.out.println("exit");
				break;   
			}
			
		}
		
	}
	
	
	
	
	
	
	
	
	
	
}


 

